<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>评价</title>
    <link rel="stylesheet" href="${e.res('/css/main.css')}">
    <link rel="stylesheet" href="${e.res('/css/essay.css')}">

    <script charset="utf-8" src="${e.res('/js/jquery-1.4.3.min.js')}"></script>
    <script charset="utf-8" src="${e.res('/js/jquery.base64.js')}"></script>
    <script src="${e.res('/js/errorHander.js')}"></script>
    

    <body>
    <#include "/pages/moudle/HeadFoot.ftl">

    <@headFoot chooseTag = "3">
    <div class="essay-show">
        <ul class="essay-section">
            <#list evalInfo.evalYears as tabL>
            <li <#if tabL_index == "0">class="current-essay"</#if> tabVal="${tabL.createYear}">${tabL.createYear}年（${tabL.countAmount}）</li>
            </#list>
        </ul>
        <ul class="essays">
            <#include "/pages/valuation/DateTab.ftl">
        </ul>
        <div class="load-more" <#if evalInfo.currentPage == evalInfo.totalPages>style="display:none;"</#if>></div>
    </div>
    </@headFoot>
    <input type="hidden" value="${evalInfo.currentPage}" name="currentPage"/>
</body>

<script type="text/javascript">


    $(".essay-section li").click(function(){
        $(this).siblings("li").removeClass("current-essay");
        $(this).addClass("current-essay");
        $("[name=currentPage]").val("1");

        var subParams = {};
        subParams.evalDate = $(this).attr("tabVal");

        $.ajax({
            url: '/queryEvalList',
            type: 'POST',
            data: subParams,
            success: function (data) {
                $(".essays").html(data);
                $(".load-more").show();
                if(parseInt($("[name=currentPage]").val()) >= parseInt($("[name=totalPages1]").val())){
                    $(".load-more").hide();
                }
            }
        });
    });
    
    $(".load-more").click(function(){
        var currentPage = parseInt($("[name=currentPage]").val());
        var totalPages = parseInt($("[name=totalPages"+currentPage+"]").val());
        if(totalPages <= currentPage){
            return;
        }
        var pageParams = {};
        pageParams.evalDate = $(".current-essay").attr("tabVal");
        pageParams.currentPage = currentPage + 1;
        $("[name=currentPage]").val(pageParams.currentPage);

        $.ajax({
            url: '/queryEvalList',
            type: 'POST',
            data: pageParams,
            success: function (data) {
                $(".essays").append(data);
                $(".load-more").show();
                if(parseInt($("[name=totalPages"+pageParams.currentPage+"]").val()) <= parseInt($("[name=currentPage]").val())){
                    $(".load-more").hide();
                }
            }
        });
    });
    
    $(".essays li").live("click", function(){
        var pdfUrl = $(this).attr('pdfUrl');
        if(pdfUrl != null || pdfUrl != "null" || pdfUrl != "")
        window.open(pdfUrl);
    });
</script>

</html>
